from demo.helper.Helper import Helper
import MySQLdb

helper = Helper()

con = MySQLdb.connect(
    host='localhost',
    user='root',
    password='root',
    port=3306,
    db='test',
    charset='utf8'
)
cursor = con.cursor()

sql = "insert into users values(%s, %s, %s, %s, %s, %s, %s)"

for x in range(0, len(helper.xing) - 1):
    xing = helper.xing[x]
    for y in range(1, 25):
        data = {
            'xing': xing,
            'ming': 'all',
            'sex': 'all',
            'num': '8888'
        }
        user_data = helper.parse_data(data)
        cursor.executemany(sql, user_data)
        con.commit()
        print(x + 1, '/', len(helper.xing), ':', y)

cursor.close()
con.close()

print('运行完毕')
